# $Id$
# Maintainer: Ronald van Haren <ronald.archlinux.org>

pkgname=qt-assistant-compat
pkgver=4.6.3
pkgrel=8
pkgdesc="compat version of Qt Assistant"
url="http://qt-project.org/"
arch=('x86_64')
license=('GPL3' 'LGPL')
depends=('qt4')
source=('http://download.qt.io/archive/qt/4.6/qt-assistant-qassistantclient-library-compat-src-4.6.3.tar.gz'
        'debian_patches_01_build_system.diff')
sha512sums=('a4050d93e448d29004d71d5ea670e60242f1272399f65db084dd928150f26404d37544d011d75bbb1c62f227752f92b86a4f4382dc54f0681a3df6da738af106'
            '241b5937adafca52420ddcd087bd32ae42c45f5764a02eb4e68c5d0bca41fb7382d75b759fece1072c0d3d2c7e924589b99807c92a41a5148cda5d9b3560d34b')

prepare() {
        cd ${srcdir}/qt-assistant-qassistantclient-library-compat-version-${pkgver}
        patch -Np1 -i ${srcdir}/debian_patches_01_build_system.diff
}

build() {
	cd ${srcdir}/qt-assistant-qassistantclient-library-compat-version-${pkgver}

	cd lib; if [ -e Makefile ]; then $(MAKE) distclean; fi
	rm -f translations/assistant_adp_*.qm

	qmake-qt4 CONFIG+=create_prl
	make
	cd  ../translations; lrelease-qt4 assistant_adp_*.ts
	cd ..
	qmake-qt4 CONFIG+=create_prl
	make
}

package() {
	cd ${srcdir}/qt-assistant-qassistantclient-library-compat-version-${pkgver}

	make install INSTALL_ROOT=${pkgdir}
	cd lib
	make install INSTALL_ROOT=${pkgdir}
	cd ..

	# Fix wrong path in prl file
	sed -i -e "/^QMAKE_PRL_BUILD_DIR/d" \
		${pkgdir}/usr/lib/libQtAssistantClient.prl

	# Install translations
	install -d ${pkgdir}/usr/share/qt4/translations/
	install -p -m0644 translations/assistant_adp_*.qm \
		${pkgdir}/usr/share/qt4/translations/

	# Install prf file
	install -D -p -m0644 features/assistant.prf \
		${pkgdir}/usr/share/qt4/mkspecs/features/assistant.prf
}
